/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ch.bbcnet.awesomeplayer;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**
 *
 * @author esingn
 */
public class ColorChooser extends JFrame implements ActionListener {
    JColorChooser jcc = new JColorChooser();
    JButton ok = new JButton("Übernehmen");
    JButton abb = new JButton("Abbrechen");
    JPanel p_jcc = new JPanel();
    JPanel p_but = new JPanel();
    Table listenGUI;
    public ColorChooser(Table ListenGUI){
        super("Design wählen");
        this.listenGUI = ListenGUI;
        p_jcc.setLayout(new FlowLayout());
        p_jcc.add(jcc);
        p_but.setLayout(new FlowLayout());
        setLayout(new FlowLayout());
        p_but.add(ok);
        ok.addActionListener(this);
        p_but.add(abb);
        abb.addActionListener(this);
        add(p_jcc);
        add(p_but);
        setSize(600,440);
        setResizable(false);
        setVisible(true);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if(e.getSource() == ok){
            listenGUI.setColor(jcc.getColor());
            dispose();
        }else if(e.getSource() == abb){
            dispose();
        }
    }
}
